<template>
  <div class="header">
     <input type="text" v-model="newMsg">
     <button @click="add">确定</button>
   </div>

   <Child />
</template>
  <script setup>
  import Child from './child.vue'
  import {ref, provide} from 'vue'
  
  const newMsg = ref('')
  const list = ref([])
  
  const add = () => {
    list.value.push(newMsg.value)
  }
  const childRef = ref(null)
  provide('list',list.value)
  </script>
  
  <style lang="css" scoped>
  
  </style>